<!DOCTYPE HTML>
<!--
	Dimension by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
 <head>
  <title>
   Dimension by HTML5 UP
  </title>
  <!-- <meta charset="utf-8" /> -->
  <!-- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> -->
  <meta charset="utf-8"/>
  <meta content="width=device-width,initial-scale=1.0" name="viewport"/>
  <link href="../../assets/css/article.css" rel="stylesheet"/>
  <link href="https://cdn.bootcss.com/highlight.js/9.15.8/styles/github.min.css" rel="stylesheet"/>
  <noscript>
   <link href="../../assets/css/noscript.css" rel="stylesheet"/>
  </noscript>
 </head>
 <body>
  <div id="app">
  </div>
  <!-- built files will be auto injected -->
 </body>
 <body class="is-preload">
  <!-- Wrapper -->
  <div id="wrapper">
   <!-- Main -->
   <div id="main">
    <article id="article">
     <h1 id="docker">
      开发中Docker常用容器记录
     </h1>
     <hr/>
     <h2 id="_1">
      概览
     </h2>
     <p>
      分享工作学习中常用的Docker容器使用：
     </p>
     <ul>
      <li>
       比如常用数据库的使用
      </li>
      <li>
       消息队列类的使用
      </li>
      <li>
       用于服务发现的容器使用
      </li>
      <li>
       还有其他工作学习中使用到的
      </li>
     </ul>
     <p>
      持续更新：https://juejin.cn/post/6965321555475693582/
     </p>
     <h2 id="_2">
      数据库
     </h2>
     <div class="codehilite">
      <pre><span></span><code>docker run --name mysql -p <span class="m">3306</span>:3306 -e <span class="nv">MYSQL_ROOT_PASSWORD</span><span class="o">=</span>root -d mysql:latest
docker run --name mysql -p <span class="m">3306</span>:3306 -e <span class="nv">MYSQL_ROOT_PASSWORD</span><span class="o">=</span>root -d mysql:latest --lower_case_table_names<span class="o">=</span><span class="m">1</span>


docker run -dit --name neo4j -p <span class="m">7474</span>:7474 -p <span class="m">7687</span>:7687 --env<span class="o">=</span><span class="nv">NEO4J_AUTH</span><span class="o">=</span>none neo4j:3.5.13

docker run -dit --name redis -p <span class="m">6379</span>:6379 redis
docker run -d --name redis -p <span class="m">6379</span>:6379 redis --requirepass <span class="s2">"password"</span>
./redis-cli -h <span class="m">127</span>.0.0.1 -p <span class="m">6379</span> -a myPassword

docker run -dit --name mongo -p <span class="m">27017</span>:27017 mongo
<span class="c1"># windows</span>
docker run  -d <span class="sb">`</span>
  -e <span class="nv">MONGO_INITDB_ROOT_USERNAME</span><span class="o">=</span><span class="nb">local</span> <span class="sb">`</span>
  -e <span class="nv">MONGO_INITDB_ROOT_PASSWORD</span><span class="o">=</span><span class="nb">local</span> <span class="sb">`</span>
  -p <span class="m">27017</span>:27017  <span class="sb">`</span>
  --name mongodb <span class="sb">`</span>
  --restart always mongo:latest

docker run  -d -e <span class="nv">MONGO_INITDB_ROOT_USERNAME</span><span class="o">=</span>mongoadmin -e <span class="nv">MONGO_INITDB_ROOT_PASSWORD</span><span class="o">=</span>secret -v /etc/localtime:/etc/localtime:ro -p <span class="m">3389</span>:27017  --name mongodb --restart always mongo:latest
<span class="c1"># linux</span>
docker run  -d <span class="se">\</span>
  -e <span class="nv">MONGO_INITDB_ROOT_USERNAME</span><span class="o">=</span>mongoadmin <span class="se">\</span>
  -e <span class="nv">MONGO_INITDB_ROOT_PASSWORD</span><span class="o">=</span>secret <span class="se">\</span>
  -v /root/docker/mongodb/data:/data/  <span class="se">\</span>
  -p <span class="m">27017</span>:27017 <span class="se">\</span>
  --network mongo-network <span class="se">\</span>
  --name mongo <span class="se">\</span>
  --restart always <span class="se">\</span>
  mongo:latest
</code></pre>
     </div>
     <h3 id="es">
      ES
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">"3.7"</span>
<span class="nt">services</span><span class="p">:</span>
    <span class="nt">kibana</span><span class="p">:</span>
        <span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">kibana:7.4.2</span>
        <span class="nt">container_name</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">kibana</span>
        <span class="nt">environment</span><span class="p">:</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">ELASTICSEARCH_HOSTS=http://es01:9200</span>
        <span class="nt">ports</span><span class="p">:</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">5601:5601</span>
        <span class="nt">networks</span><span class="p">:</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">elastic</span>
    <span class="nt">es01</span><span class="p">:</span>
        <span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">elasticsearch:7.4.2</span>
        <span class="nt">environment</span><span class="p">:</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">node.name=es01</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">cluster.name=es-docker-cluster</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">network.host=_local_,_site_</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">network.publish_host=_local_</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">discovery.type=single-node</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">bootstrap.memory_lock=true</span>
            <span class="p p-Indicator">-</span> <span class="s">"ES_JAVA_OPTS=-Xms750m</span><span class="nv"> </span><span class="s">-Xmx750m"</span>
            <span class="p p-Indicator">-</span> <span class="s">"ELASTIC_PASSWORD=password"</span>
        <span class="nt">ulimits</span><span class="p">:</span>
            <span class="nt">memlock</span><span class="p">:</span>
                <span class="nt">soft</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">-1</span>
                <span class="nt">hard</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">-1</span>
            <span class="nt">nofile</span><span class="p">:</span>
                <span class="nt">soft</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">65535</span>
                <span class="nt">hard</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">65535</span>
        <span class="nt">ports</span><span class="p">:</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">9200:9200</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">9300:9300</span>
        <span class="nt">networks</span><span class="p">:</span>
            <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">elastic</span>
<span class="nt">networks</span><span class="p">:</span>
  <span class="nt">elastic</span><span class="p">:</span>
    <span class="nt">driver</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">bridge</span>
</code></pre>
     </div>
     <p>
      使用过程中需要安装IK分词
     </p>
     <p>
      ```shell script
// 进入容器es
docker exec -it es /bin/bash
// 使用bin目录下的elasticsearch-plugin install安装ik插件,注意与ES版本的一致性
bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip
// 再重启下容器
docker restart es
     </p>
     <div class="codehilite">
      <pre><span></span><code><span class="o">-</span> <span class="p">[</span><span class="mi">2</span><span class="p">.</span><span class="mi">4</span><span class="o">-</span><span class="n">docker</span> <span class="n">es安装插件</span><span class="p">](</span><span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">www</span><span class="p">.</span><span class="n">jianshu</span><span class="p">.</span><span class="n">com</span><span class="o">/</span><span class="n">p</span><span class="o">/</span><span class="mi">275</span><span class="n">e629535f6</span><span class="p">)</span>
<span class="o">-</span> <span class="p">[</span><span class="n">ES</span> <span class="o">-</span> <span class="err">基于</span><span class="n">Golang的简单使用ElasticSearch</span><span class="p">](</span><span class="n">tkstorm</span><span class="p">.</span><span class="n">com</span><span class="o">/</span><span class="n">posts</span><span class="o">-</span><span class="n">list</span><span class="o">/</span><span class="n">software</span><span class="o">-</span><span class="n">engineering</span><span class="o">/</span><span class="n">elastic</span><span class="o">/</span><span class="n">es</span><span class="o">-</span><span class="n">docker</span><span class="o">/</span><span class="p">)</span>
<span class="o">-</span> <span class="p">[</span><span class="n">Elasticsearch</span> <span class="err">——</span> <span class="n">docker部署</span><span class="o">+</span><span class="n">ik分词器</span><span class="p">](</span><span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">www</span><span class="p">.</span><span class="n">jianshu</span><span class="p">.</span><span class="n">com</span><span class="o">/</span><span class="n">p</span><span class="o">/</span><span class="n">d8b0c736070f</span><span class="p">)</span>

<span class="o">##</span> <span class="err">服务发现</span>
<span class="o">###</span> <span class="n">Nacos</span>
<span class="o">```</span><span class="n">shell</span>
<span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="p">.</span><span class="n">com</span><span class="o">/</span><span class="n">nacos</span><span class="o">-</span><span class="k">group</span><span class="o">/</span><span class="n">nacos</span><span class="o">-</span><span class="n">docker</span><span class="p">.</span><span class="n">git</span>
<span class="n">cd</span> <span class="n">nacos</span><span class="o">-</span><span class="n">docker</span>
<span class="n">docker</span><span class="o">-</span><span class="n">compose</span> <span class="o">-</span><span class="n">f</span> <span class="n">example</span><span class="o">/</span><span class="n">standalone</span><span class="o">-</span><span class="n">derby</span><span class="p">.</span><span class="n">yaml</span> <span class="n">up</span>

<span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">localhost</span><span class="p">:</span><span class="mi">8848</span><span class="o">/</span><span class="n">nacos</span><span class="o">/#/</span><span class="n">login</span>

<span class="err">用户名和密码</span>
<span class="n">nacos</span>
<span class="n">nacos</span>
</code></pre>
     </div>
     <h3 id="etcd">
      etcd
     </h3>
     <p>
      ```shell script
NODE1=192.168.1.21
DATA_DIR="etcd-data"
     </p>
     <h1 id="v3">
      v3
     </h1>
     <p>
      REGISTRY=gcr.io/etcd-development/etcd
     </p>
     <p>
      docker run \
  -p 2379:2379 \
  -p 2380:2380 \
  --volume=${DATA_DIR}:/etcd-data \
  --name etcd ${REGISTRY}:latest \
  /usr/local/bin/etcd \
  --data-dir=/etcd-data --name node1 \
  --initial-advertise-peer-urls http://${NODE1}:2380 --listen-peer-urls http://0.0.0.0:2380 \
  --advertise-client-urls http://${NODE1}:2379 --listen-client-urls http://0.0.0.0:2379 \
  --initial-cluster node1=http://${NODE1}:2380
     </p>
     <p>
      docker run -p 2379:2379 -p 2380:2380 --name etcd quay.io/coreos/etcd:latest /usr/local/bin/etcd --data-dir=/etcd-data --name node1 --initial-advertise-peer-urls http://192.168.101.112:2380 --listen-peer-urls http://0.0.0.0:2380 --advertise-client-urls http://192.168.101.112:2379 --listen-client-urls http://0.0.0.0:2379 --initial-cluster node1=http://192.168.101.112:2380
     </p>
     <p>
      docker run -dit --name etcd_web -p 8081:8080 evildecay/etcdkeeper
     </p>
     <div class="codehilite">
      <pre><span></span><code><span class="err">### zookeeper</span>
<span class="err">```shell script</span>
<span class="err">docker run -dit --name zk -p 2181:2181 zookeeper</span>
</code></pre>
     </div>
     <h3 id="consul">
      Consul
     </h3>
     <p>
      ```shell script
     </p>
     <h1 id="linux">
      linux
     </h1>
     <p>
      docker run \
    -d \
    -p 8500:8500 \
    -p 8600:8600/udp \
    --name=consul_badger \
    consul agent -server -ui -node=server-1 -bootstrap-expect=1 -client=0.0.0.0
     </p>
     <h1 id="windows">
      windows
     </h1>
     <p>
      docker run
      <code>
       -d
      </code>
      -p 8500:8500
      <code>
       -p 8600:8600/udp
      </code>
      --name=consul_badger
      <code>
       -v D:\Docker\compose\consul:/consul/config
      </code>
      consul agent -server -ui
      <code>
       -node
      </code>
      =server-1
      <code>
       -bootstrap-expect
      </code>
      =1
      <code>
       -client
      </code>
      =0.0.0.0
     </p>
     <h1 id="acl-config-in-consulconfig">
      ACL config in /consul/config
     </h1>
     <p>
      {
    "datacenter": "dc1",
    "bootstrap_expect": 1,
    "log_level": "INFO",
    "node_name": "consul_server_1",
    "client_addr": "0.0.0.0",
    "server": true,
    "ui": true,
    "enable_script_checks": true,
    "addresses": {
        "https": "0.0.0.0",
        "dns": "0.0.0.0"
    }
}
     </p>
     <p>
      primary_datacenter = "dc1"
acl {
  enabled = true
  default_policy = "deny"
  enable_token_persistence = true
  tokens { 
    master = "474dcea7-ee4d-3f11-1af1-a38eb37d3f5d"
  }
}
     </p>
     <div class="codehilite">
      <pre><span></span><code><span class="err">## 消息队列</span>
<span class="err">### docker-activemq</span>
<span class="err">```shell script</span>
<span class="err">docker run -dit --name activemq -p 11616:61616 -p 8161:8161 -p 1883:1883 rmohr/activemq</span>
</code></pre>
     </div>
     <p>
      初始账号：
admin admin
user user
     </p>
     <h3 id="docker-rabbitmq">
      docker rabbitmq
     </h3>
     <p>
      ```shell script
docker run -dit --name rabbitmq -p 5672:5672 rabbitmq
     </p>
     <p>
      docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:management
     </p>
     <p>
      http://127.0.0.1:15672
     </p>
     <p>
      用户和密码：
guest
guest
     </p>
     <div class="codehilite">
      <pre><span></span><code><span class="o">##</span> <span class="err">其他</span>
<span class="o">###</span> <span class="n">Nginx</span>
<span class="o">```</span><span class="n">shell</span> <span class="n">script</span>
<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">dit</span> <span class="c1">--name nginx --restart=always -p 80:80 -v D:/Docker/images/nginx/:/etc/nginx/ -v D:/Docker/images/nginx/download:/home/download/ nginx</span>

<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">dit</span> <span class="c1">--name nginx -p 80:80 -v D:/Docker/images/nginx/config/:/etc/nginx/ -v D:/Docker/images/nginx/download:/home/download/ nginx</span>
</code></pre>
     </div>
     <h3 id="yapi">
      前后端接口管理：Yapi
     </h3>
     <p>
      ```shell script
git clone https://gitee.com/fjc0k/docker-YApi.git
docker-compose up -d
     </p>
     <p>
      然后，通过 http://localhost:40001 即可访问 YApi。
用户密码在docker-compose.yml中，YAPI_ADMIN_ACCOUNT 为你的管理员邮箱，YAPI_ADMIN_PASSWORD 为你的管理员密码
     </p>
     <div class="codehilite">
      <pre><span></span><code><span class="cp">### Kong</span>
<span class="o">-</span> <span class="p">[</span><span class="n">Documentation</span> <span class="k">for</span> <span class="n">Kong</span> <span class="n">Gateway</span> <span class="p">(</span><span class="n">OSS</span><span class="p">)](</span><span class="nl">https</span><span class="p">:</span><span class="c1">//docs.konghq.com/gateway-oss/2.2.x/)</span>
<span class="o">-</span> <span class="p">[</span><span class="n">Docker</span> <span class="n">Installation</span><span class="p">](</span><span class="nl">https</span><span class="p">:</span><span class="c1">//docs.konghq.com/install/docker/?_ga=2.15676593.643431049.1616122322-97521002.1616122322)</span>

<span class="err">```</span><span class="n">shell</span> <span class="n">script</span>
<span class="cp"># linux</span>
<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">d</span> <span class="o">--</span><span class="n">name</span> <span class="n">kong</span> \
     <span class="o">--</span><span class="n">network</span><span class="o">=</span><span class="n">kong</span><span class="o">-</span><span class="n">net</span> \
     <span class="o">-</span><span class="n">v</span> <span class="s">"kong-vol:/usr/local/kong/declarative"</span> \
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_DATABASE=off"</span> \
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_DECLARATIVE_CONFIG=/usr/local/kong/declarative/kong.yml"</span> \
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_PROXY_ACCESS_LOG=/dev/stdout"</span> \
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_ADMIN_ACCESS_LOG=/dev/stdout"</span> \
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_PROXY_ERROR_LOG=/dev/stderr"</span> \
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_ADMIN_ERROR_LOG=/dev/stderr"</span> \
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl"</span> \
     <span class="o">-</span><span class="n">p</span> <span class="mi">8000</span><span class="o">:</span><span class="mi">8000</span> \
     <span class="o">-</span><span class="n">p</span> <span class="mi">8443</span><span class="o">:</span><span class="mi">8443</span> \
     <span class="o">-</span><span class="n">p</span> <span class="mf">127.0.0.1</span><span class="o">:</span><span class="mi">8001</span><span class="o">:</span><span class="mi">8001</span> \
     <span class="o">-</span><span class="n">p</span> <span class="mf">127.0.0.1</span><span class="o">:</span><span class="mi">8444</span><span class="o">:</span><span class="mi">8444</span> \
     <span class="nl">kong</span><span class="p">:</span><span class="n">latest</span>


<span class="cp"># windows</span>
<span class="n">docker</span> <span class="n">network</span> <span class="n">create</span> <span class="n">kong</span><span class="o">-</span><span class="n">net</span>

<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">d</span> <span class="o">--</span><span class="n">name</span> <span class="n">kong</span><span class="o">-</span><span class="n">database</span> <span class="err">`</span>
               <span class="o">--</span><span class="n">network</span><span class="o">=</span><span class="n">kong</span><span class="o">-</span><span class="n">net</span> <span class="err">`</span>
               <span class="o">-</span><span class="n">p</span> <span class="mi">5432</span><span class="o">:</span><span class="mi">5432</span> <span class="err">`</span>
               <span class="o">-</span><span class="n">e</span> <span class="s">"POSTGRES_USER=kong"</span> <span class="err">`</span>
               <span class="o">-</span><span class="n">e</span> <span class="s">"POSTGRES_DB=kong"</span> <span class="err">`</span>
               <span class="o">-</span><span class="n">e</span> <span class="s">"POSTGRES_PASSWORD=kong"</span> <span class="err">`</span>
               <span class="nl">postgres</span><span class="p">:</span><span class="mf">9.6</span>

<span class="n">docker</span> <span class="n">run</span> <span class="o">--</span><span class="n">rm</span> <span class="err">`</span>
     <span class="o">--</span><span class="n">network</span><span class="o">=</span><span class="n">kong</span><span class="o">-</span><span class="n">net</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_DATABASE=postgres"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_PG_HOST=kong-database"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_PG_PASSWORD=kong"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_CASSANDRA_CONTACT_POINTS=kong-database"</span> <span class="err">`</span>
     <span class="nl">kong</span><span class="p">:</span><span class="n">latest</span> <span class="n">kong</span> <span class="n">migrations</span> <span class="n">bootstrap</span>

<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">d</span> <span class="o">--</span><span class="n">name</span> <span class="n">kong</span> <span class="err">`</span>
     <span class="o">--</span><span class="n">network</span><span class="o">=</span><span class="n">kong</span><span class="o">-</span><span class="n">net</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_DATABASE=postgres"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_PG_HOST=kong-database"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_PG_PASSWORD=kong"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_CASSANDRA_CONTACT_POINTS=kong-database"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_PROXY_ACCESS_LOG=/dev/stdout"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_ADMIN_ACCESS_LOG=/dev/stdout"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_PROXY_ERROR_LOG=/dev/stderr"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_ADMIN_ERROR_LOG=/dev/stderr"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">e</span> <span class="s">"KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl"</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">p</span> <span class="mi">8000</span><span class="o">:</span><span class="mi">8000</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">p</span> <span class="mi">8443</span><span class="o">:</span><span class="mi">8443</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">p</span> <span class="mi">8001</span><span class="o">:</span><span class="mi">8001</span> <span class="err">`</span>
     <span class="o">-</span><span class="n">p</span> <span class="mi">8444</span><span class="o">:</span><span class="mi">8444</span> <span class="err">`</span>
     <span class="nl">kong</span><span class="p">:</span><span class="n">latest</span>

<span class="n">curl</span> <span class="o">-</span><span class="n">i</span> <span class="nl">http</span><span class="p">:</span><span class="c1">//localhost:8001/</span>

<span class="n">docker</span> <span class="n">run</span> <span class="o">--</span><span class="n">rm</span> <span class="n">pantsel</span><span class="o">/</span><span class="nl">konga</span><span class="p">:</span><span class="n">latest</span> <span class="o">-</span><span class="n">c</span> <span class="n">prepare</span> <span class="o">-</span><span class="n">a</span> <span class="n">postgres</span> <span class="o">-</span><span class="n">u</span> <span class="nl">postgresql</span><span class="p">:</span><span class="c1">//kong:kong@192.168.110.242:5432/konga</span>

<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">p</span> <span class="mi">1337</span><span class="o">:</span><span class="mi">1337</span> <span class="err">`</span>
        <span class="o">--</span><span class="n">network</span> <span class="n">kong</span><span class="o">-</span><span class="n">net</span> <span class="err">`</span>
        <span class="o">--</span><span class="n">name</span> <span class="n">konga</span> <span class="err">`</span>
        <span class="o">-</span><span class="n">e</span> <span class="s">"NODE_ENV=production"</span>  <span class="err">`</span>
        <span class="o">-</span><span class="n">e</span> <span class="s">"DB_ADAPTER=postgres"</span> <span class="err">`</span>
        <span class="o">-</span><span class="n">e</span> <span class="s">"DB_URI=postgresql://kong:kong@192.168.110.242:5432/konga"</span> <span class="err">`</span>
        <span class="n">pantsel</span><span class="o">/</span><span class="n">konga</span>
</code></pre>
     </div>
     <h3 id="portainer-docker">
      Portainer - Docker的可视化管理工具使用详解
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="o">#</span> <span class="n">linux</span>
<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">d</span> <span class="o">-</span><span class="n">p</span> <span class="mi">9000</span><span class="p">:</span><span class="mi">9000</span> <span class="c1">--name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /home/docker/portainer/data:/data portainer/portainer</span>

<span class="o">#</span> <span class="n">windows</span>
<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">d</span> <span class="o">-</span><span class="n">p</span> <span class="mi">9000</span><span class="p">:</span><span class="mi">9000</span> <span class="c1">--name portainer --restart always -v -v D:/temp/docker/portainer/docker_engine:/var/run/pipe/docker_engine -v D:/temp/docker/portainer/data:/data portainer/portainer</span>

<span class="err">用户和密码：</span>
<span class="k">admin</span> <span class="n">password</span>
</code></pre>
     </div>
     <h3 id="centos">
      Centos
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">tid</span> <span class="c1">--name centos8 -p 82:80 -v D:/temp/centos/:/root/ centos</span>
<span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">tid</span> <span class="c1">--name centos8 --net=host -v D:/temp/centos/:/root/ centos</span>

<span class="n">cd</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">yum</span><span class="p">.</span><span class="n">repos</span><span class="p">.</span><span class="n">d</span><span class="o">/</span>
<span class="n">sed</span> <span class="o">-</span><span class="n">i</span> <span class="s1">'s/mirrorlist/#mirrorlist/g'</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">yum</span><span class="p">.</span><span class="n">repos</span><span class="p">.</span><span class="n">d</span><span class="o">/</span><span class="n">CentOS</span><span class="o">-*</span>
<span class="n">sed</span> <span class="o">-</span><span class="n">i</span> <span class="s1">'s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g'</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">yum</span><span class="p">.</span><span class="n">repos</span><span class="p">.</span><span class="n">d</span><span class="o">/</span><span class="n">CentOS</span><span class="o">-*</span>
<span class="n">yum</span> <span class="k">update</span> <span class="o">-</span><span class="n">y</span>
</code></pre>
     </div>
     <ul>
      <li>
       <a href="https://techglimpse.com/failed-metadata-repo-appstream-centos-8/">
        Failed to download metadata for repo ‘AppStream’ [CentOS]
       </a>
      </li>
     </ul>
     <h3 id="_3">
      本地镜像仓库
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">d</span> <span class="o">-</span><span class="n">p</span> <span class="mi">5000</span><span class="p">:</span><span class="mi">5000</span> <span class="c1">--name registry --restart=always -v D:/Docker/registry:/var/lib/registry registry:latest</span>

<span class="o">#</span> <span class="err">在</span><span class="n">docker</span> <span class="n">deamon</span> <span class="err">中加入</span> <span class="mi">127</span><span class="p">.</span><span class="mi">0</span><span class="p">.</span><span class="mi">0</span><span class="p">.</span><span class="mi">1</span><span class="p">:</span><span class="mi">5000</span>
<span class="err">{</span>
  <span class="ss">"builder"</span><span class="p">:</span> <span class="err">{</span>
    <span class="ss">"gc"</span><span class="p">:</span> <span class="err">{</span>
      <span class="ss">"defaultKeepStorage"</span><span class="p">:</span> <span class="ss">"20GB"</span><span class="p">,</span>
      <span class="ss">"enabled"</span><span class="p">:</span> <span class="k">true</span>
    <span class="err">}</span>
  <span class="err">}</span><span class="p">,</span>
  <span class="ss">"experimental"</span><span class="p">:</span> <span class="k">false</span><span class="p">,</span>
  <span class="ss">"features"</span><span class="p">:</span> <span class="err">{</span>
    <span class="ss">"buildkit"</span><span class="p">:</span> <span class="k">true</span>
  <span class="err">}</span><span class="p">,</span>
  <span class="ss">"insecure-registries"</span><span class="p">:</span> <span class="p">[</span>
    <span class="ss">"127.0.0.1:5000"</span>
  <span class="p">]</span>
<span class="err">}</span>

<span class="o">#</span> <span class="err">上传</span>
<span class="n">docker</span> <span class="n">tag</span> <span class="n">xxxx</span><span class="p">:</span><span class="n">test</span> <span class="mi">192</span><span class="p">.</span><span class="mi">168</span><span class="p">.</span><span class="mi">110</span><span class="p">.</span><span class="mi">196</span><span class="p">:</span><span class="mi">5000</span><span class="o">/</span><span class="n">xxxx</span><span class="p">:</span><span class="n">test</span>
<span class="n">docker</span> <span class="n">push</span> <span class="mi">192</span><span class="p">.</span><span class="mi">168</span><span class="p">.</span><span class="mi">110</span><span class="p">.</span><span class="mi">196</span><span class="p">:</span><span class="mi">5000</span><span class="o">/</span><span class="n">xxxx</span><span class="p">:</span><span class="n">test</span>

<span class="o">#</span> <span class="err">下载</span>
<span class="n">docker</span> <span class="n">pull</span> <span class="mi">192</span><span class="p">.</span><span class="mi">168</span><span class="p">.</span><span class="mi">110</span><span class="p">.</span><span class="mi">196</span><span class="p">:</span><span class="mi">5000</span><span class="o">/</span><span class="n">xxxx</span><span class="p">:</span><span class="n">test</span>
</code></pre>
     </div>
     <ul>
      <li>
       <a href="https://blog.csdn.net/qq_2300688967/article/details/83545647">
        docker 搭建本地私有仓库及镜像上传时HTTPS client问题解决(windows 10)
       </a>
      </li>
      <li>
       <a href="https://yeasy.gitbook.io/docker_practice/repository/registry">
        私有仓库
       </a>
      </li>
     </ul>
    </article>
   </div>
   <!-- Footer -->
   <footer id="footer">
    <p class="copyright">
     © Untitled. Design:
     <a href="https://html5up.net">
      HTML5 UP
     </a>
     .
    </p>
   </footer>
  </div>
  <!-- BG -->
  <div id="bg">
  </div>
  <!-- Scripts -->
  <script src="../assets/js/jquery.min.js">
  </script>
  <script src="../assets/js/browser.min.js">
  </script>
  <script src="../assets/js/breakpoints.min.js">
  </script>
  <script src="../assets/js/util.js">
  </script>
  <script src="../assets/js/main.js">
  </script>
 </body>
</html>
